import request from '@/utils/request'

// 查询生成表数据
export function listTable(query) {
  return request({
    url: '/tool/gen/list',
    method: 'get',
    params: query
  })
}
// 查询db数据库列表
export function listDbTable(query) {
  return request({
    url: '/tool/gen/db/list',
    method: 'get',
    params: query
  })
}

// 查询mdls数据库列表
export function listMdlsTable(query) {
  return request({
    url: '/tool/gen/mdls/list',
    method: 'get',
    params: query
  })
}

// 查询表详细信息
export function listMdlsColumn(query) {
  return request({
    url: '/tool/gen/mdlscolumn/list',
    method: 'get',
    params: query
  })
}

// 查询表详细信息
export function getGenTable(tableId) {
  return request({
    url: '/tool/gen/' + tableId,
    method: 'get'
  })
}

// 修改代码生成信息
export function updateGenTable(data) {
  return request({
    url: '/tool/gen',
    method: 'put',
    data: data
  })
}

// 导入表
export function importTable(data) {
  return request({
    url: '/tool/gen/importTable',
    method: 'post',
    params: data
  })
}

// 修改表名
export function updateTable(data) {
  return request({
    url: '/tool/gen/updateTable',
    method: 'post',
    params: data
  })
}

//修改字段长度
export function updateColumn(data) {
  return request({
    url: '/tool/gen/updateColumn',
    method: 'post',
    params: data
  })
}

// 预览生成代码
export function previewTable(tableId) {
  return request({
    url: '/tool/gen/preview/' + tableId,
    method: 'get'
  })
}

// 删除表数据
export function delTable(tableId) {
  return request({
    url: '/tool/gen/' + tableId,
    method: 'delete'
  })
}

// 生成代码（自定义路径）
export function genCode(tableName) {
  return request({
    url: '/tool/gen/genCode/' + tableName,
    method: 'get'
  })
}

// 同步数据库
export function synchDb(tableName) {
  return request({
    url: '/tool/gen/synchDb/' + tableName,
    method: 'get'
  })
}
//查询表数据
export function allList(query){
  return request({
    url: '/library/information/allList/',
    method: 'get',
    params: query
  })
}

//同步GcbxsFile
export function sycGcbxsFile(data){
  return request({
    url: '/library/information/sycGcbxsFile/',
    method: 'post',
    params: data
  })
}
//同步GcbxsImage
export function sycGcbxsImage(data){
  return request({
    url: '/library/information/sycGcbxsImage/',
    method: 'post',
    params: data
  })
}
//同步XxzyqkFile
export function sycXxzyqkFile(data){
  return request({
    url: '/library/information/sycXxzyqkFile/',
    method: 'post',
    params: data
  })
}
//同步GcbxxzyqkImage
export function sycGcbxxzyqkImage(data){
  return request({
    url: '/library/information/sycGcbxxzyqkImage/',
    method: 'post',
    params: data
  })
}
//同步XxzytsFile
export function sycXxzytsFile(data){
  return request({
    url: '/library/information/sycXxzytsFile/',
    method: 'post',
    params: data
  })
}
//同步GcbxxzytsImage
export function sycGcbxxzytsImage(data){
  return request({
    url: '/library/information/sycGcbxxzytsImage/',
    method: 'post',
    params: data
  })
}
//获取maxSysid
export function maxSysId(tableName) {
  return request({
    url: '/library/information/maxSysId/'+ tableName,
    method: 'get'
  })
}
